FROM centos

MAINTAINER cshi

# ENV has 1 forms. 这些变量都是用于build stage
ENV k1 v1
# 第2种form可以一次设置多个值
ENV k2=v2,k3="v3 v4"

WORKDIR /app
COPY . .

# RUN has two forms, shell form, exec form

# shell form
# k3 cannot be used within shell itself, it's just used in Dockerfile
RUN echo "this is shell form, backed by /bin/sh -c default"; \
	echo "path=$PATH. one of ENV variable k3=$k3"

RUN ["/bin/bash", "-c", "echo \"this is exec form\""]

# main purpose of CMD is to provide defaults fo an executing container
# CMD has 3 forms

# default parameters to ENTRYPOINT. If this is the case, then CMD and ENTRYPOINT must be specified with JSON array format
CMD ["3", "4"]

# shell form
CMD ls /usr

# 官网说要这种exec form要给Full path，但貌似这样也行？
CMD ["wc", "--help"]

RUN echo "pwd=$(pwd)"; ls; ls -l bin

# exec form, this is the preferred form of CMD
CMD ["bin/app.sh", "4"]

# the last CMD will take effect

# if user specifies command to docker run, then the default specified in CMD will be overridden
